<div class="form">
<script>
</script>
<?php $form = $this->beginWidget('CActiveForm', array(
    'id' => 'customers-form',
    'enableAjaxValidation' => false,

    'htmlOptions' => array(
        'enctype' => 'multipart/form-data',
    )


));
$discount = $model->discount;
$latecharge = $model->latecharge;

if ($model->isNewRecord) {
    $latecharge = $discount = '0.00';

}
?>

<p class="note">Fields with <span class="required">*</span> are required.</p>

<?php echo $form->errorSummary($model); ?>
<div class="row">

    <?php echo $form->labelEx($model, 'image'); ?>


    <?php echo $form->fileField($model, 'file');?>
    <?php echo $form->error($model, 'file'); ?>
</div>

<div class="row">
    <?php echo $form->labelEx($model, 'custno'); ?>
    <div class="model-data"><?php echo $model->custno;?> </div>
    <?php echo $form->error($model, 'custno'); ?>
</div>

<div class="row">
    <?php echo $form->labelEx($model, 'lastname'); ?>
    <?php echo $form->textField($model, 'lastname', array('size' => 50, 'maxlength' => 50)); ?>
    <?php echo $form->error($model, 'lastname'); ?>
</div>

<div class="row">
    <?php echo $form->labelEx($model, 'firstname'); ?>
    <?php echo $form->textField($model, 'firstname', array('size' => 25, 'maxlength' => 25)); ?>
    <?php echo $form->error($model, 'firstname'); ?>
</div>

<div class="row">
    <?php echo $form->labelEx($model, 'add1'); ?>
    <?php echo $form->textField($model, 'add1', array('size' => 50, 'maxlength' => 50)); ?>
    <?php echo $form->error($model, 'add1'); ?>
</div>

<div class="row">
    <?php echo $form->labelEx($model, 'add2'); ?>
    <?php echo $form->textField($model, 'add2', array('size' => 50, 'maxlength' => 50)); ?>
    <?php echo $form->error($model, 'add2'); ?>
</div>

<div class="row">
    <?php echo $form->labelEx($model, 'city'); ?>
    <?php echo $form->textField($model, 'city', array('size' => 30, 'maxlength' => 30)); ?>
    <?php echo $form->error($model, 'city'); ?>
</div>

<div class="row">
    <?php echo $form->labelEx($model, 'state'); ?>
    <?php echo $form->dropDownList($model, 'state', getStateList()); ?>
    <?php echo $form->error($model, 'state'); ?>
</div>

<div class="row">
    <?php echo $form->labelEx($model, 'zip'); ?>
    <?php echo $form->textField($model, 'zip', array('size' => 10, 'maxlength' => 10)); ?>
    <?php echo $form->error($model, 'zip'); ?>
</div>

<div class="row">
    <?php echo $form->labelEx($model, 'county'); ?>
    <?php echo $form->textField($model, 'county', array('size' => 10, 'maxlength' => 150)); ?>
    <?php echo $form->error($model, 'county'); ?>
</div>

<div class="row">
    <?php echo $form->labelEx($model, 'terms'); ?>
    <div class="model-data">
        <?php echo $model->termList[$model->terms] ?>
    </div>
    <?php //echo $form->dropDownList($model,'terms',$model->termList); ?>
    <?php echo $form->error($model, 'terms'); ?>
</div>


<?php echo $form->hiddenField($model, 'custref', array('size' => 15, 'maxlength' => 15)); ?>


<?php echo $form->hiddenField($model, 'statement'); ?>


<div class="row">
    <?php echo $form->labelEx($model, 'requirepo'); ?>
    <?php echo $form->checkBox($model, 'requirepo'); ?>
    <?php echo $form->error($model, 'requirepo'); ?>
</div>


<?php echo $form->hiddenField($model, 'post'); ?>




<?php echo $form->hiddenField($model, 'defpriority', array('size' => 6, 'maxlength' => 6)); ?>


<div class="row">
    <?php echo $form->labelEx($model, 'salesperson'); ?>
    <div class="model-data">
        <?php echo $model->SalePersonList[$model->salesperson]  ?>

    </div>
</div>
<?php
$salesPerson = Employees::model()->findByPk($model->salesperson);

?>
<div class="row">
    <label style="margin-left: 30px; width: 120px;"> Email </label>

    <div class="model-data">
        <a href="mailto:<?php echo $salesPerson->workemail; ?>"><?php echo $salesPerson->workemail; ?></a></div>
</div>
<div class="row">
    <label style="margin-left: 30px; width: 120px;"> Mobile </label>

    <div class="model-data">
        <?php echo $salesPerson->workcell; ?> </div>
</div>
<?php $company = Companyinfo::model()->find(); ?>
<div class="row">
    <label style="margin-left: 30px; width: 120px;"> Office </label>

    <div class="model-data"><?php echo $company->phone; ?> </div>
    <br/>
</div>
<div class="row">
    <label style="margin-left: 30px; width: 120px;"> Fax </label>

    <div class="model-data"> <?php echo $company->fax; ?>  </div>
    <br/>

</div>


<div class="row">
    <?php echo $form->labelEx($model, 'website'); ?>
    <?php echo $form->textField($model, 'website', array('size' => 60, 'maxlength' => 128)); ?>
    <?php echo $form->error($model, 'website'); ?>
</div>

<div class="row">
    <?php echo $form->labelEx($model, 'emailstatement'); ?>
    <?php echo $form->checkBox($model, 'emailstatement'); ?>
    <?php echo $form->error($model, 'emailstatement'); ?>
</div>


<div class="row_buttons">
    <?php
    $buttonText = 'Update';

    echo CHtml::submitButton($buttonText); ?>
</div>

<?php $this->endWidget(); ?>

</div><!-- form -->